Here, we’re just setting a few options.
knitr::opts_chunk$set(
warning = TRUE, # show warnings during codebook generation
message = TRUE, # show messages during codebook generation
error = TRUE, # do not interrupt codebook generation in case of errors,
# usually better for debugging
echo = TRUE # show R code
)
ggplot2::theme_set(ggplot2::theme_bw())
Now, we’re preparing our data for the codebook.
library(codebook)
webshot::install_phantomjs()
## It seems that the version of `phantomjs` installed is greater than or equal to the requested version.To install the requested version or downgrade to another version, use `force = TRUE`.
library(labelled)
##
## Attaching package: 'labelled'
## The following object is masked from 'package:codebook':
##
## to_factor
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
# codebook_data <- codebook::bfi
# to import an SPSS file from the same folder uncomment and edit the line below
# codebook_data <- rio::import("mydata.sav")
# for Stata
# codebook_data <- rio::import("mydata.dta")
# for CSV
codebook_data <- rio::import("widthdepth_pilotdata.csv")
codebook_dictionary <- rio::import("widthdepth_pilotdata_codebook.csv")
var_label(codebook_data) <- codebook_dictionary %>% select(variable, label) %>% dict_to_list()
metadata(codebook_data)$name <- 'Manipulating Width vs Depth, Pilot Study, Codebook'
metadata(codebook_data)$description <- "Adult pilto data associated with the paper 'Dangerous ground: One-year-old infants are sensitive to peril in other agents’ action plans'"
metadata(codebook_data)$creator <- "Shari Liu"
metadata(codebook_data)$datePublished <- "2022-06-18"
# omit the following lines, if your missing values are already properly labelled
# codebook_data <- detect_missing(codebook_data,
# only_labelled = TRUE, # only labelled values are autodetected as
# # missing
# negative_values_are_missing = FALSE, # negative values are missing values
# ninety_nine_problems = TRUE, # 99/999 are missing values, if they
# # are more than 5 MAD from the median
# )
# If you are not using formr, the codebook package needs to guess which items
# form a scale. The following line finds item aggregates with names like this:
# scale = scale_1 + scale_2R + scale_3R
# identifying these aggregates allows the codebook function to
# automatically compute reliabilities.
# However, it will not reverse items automatically.
# codebook_data <- detect_scales(codebook_data)
Create codebook
skim_codebook(codebook_data)
| Name | data |
| Number of rows | 456 |
| Number of columns | 6 |
| _______________________ | |
| Column type frequency: | |
| character | 1 |
| numeric | 5 |
| ________________________ | |
| Group variables | None |
Variable type: character
| skim_variable | n_missing | complete_rate | min | max | empty | n_unique | whitespace |
|---|---|---|---|---|---|---|---|
| dv | 0 | 1 | 5 | 11 | 0 | 3 | 0 |
Variable type: numeric
| skim_variable | n_missing | complete_rate | mean | sd | min | median | max | hist |
|---|---|---|---|---|---|---|---|---|
| V1 | 0 | 1 | 228.50 | 131.78 | 1 | 228.5 | 456 | ▇▇▇▇▇ |
| Depth | 0 | 1 | 2.45 | 1.07 | 1 | 2.0 | 4 | ▆▇▁▇▆ |
| Width | 0 | 1 | 2.47 | 1.14 | 1 | 2.0 | 4 | ▇▇▁▆▇ |
| subj | 0 | 1 | 9.97 | 5.48 | 1 | 10.0 | 19 | ▇▇▆▇▇ |
| response | 0 | 1 | 60.46 | 31.60 | 0 | 70.0 | 100 | ▃▃▂▆▇ |
codebook(codebook_data)
## No missing values.
Dataset name: Manipulating Width vs Depth, Pilot Study, Codebook
Adult pilto data associated with the paper ‘Dangerous ground: One-year-old infants are sensitive to peril in other agents’ action plans’
Date published: 2022-06-18
Creator:
| name | value |
|---|---|
| 1 | Shari Liu |
|
#Variables
Distribution of values for V1
0 missing values.
| name | data_type | n_missing | complete_rate | min | median | max | mean | sd | hist | label |
|---|---|---|---|---|---|---|---|---|---|---|
| V1 | numeric | 0 | 1 | 1 | 228 | 456 | 228.5 | 131.7801 | ▇▇▇▇▇ | NA |
depth of the trench on the current trial, range 1-4
Distribution of values for Depth
0 missing values.
| name | label | data_type | n_missing | complete_rate | min | median | max | mean | sd | hist |
|---|---|---|---|---|---|---|---|---|---|---|
| Depth | depth of the trench on the current trial, range 1-4 | numeric | 0 | 1 | 1 | 2 | 4 | 2.447368 | 1.069802 | ▆▇▁▇▆ |
width of the trench on the current trial, range 1-4
Distribution of values for Width
0 missing values.
| name | label | data_type | n_missing | complete_rate | min | median | max | mean | sd | hist |
|---|---|---|---|---|---|---|---|---|---|---|
| Width | width of the trench on the current trial, range 1-4 | numeric | 0 | 1 | 1 | 2 | 4 | 2.473684 | 1.136492 | ▇▇▁▆▇ |
de-identified subject id
Distribution of values for subj
0 missing values.
| name | label | data_type | n_missing | complete_rate | min | median | max | mean | sd | hist |
|---|---|---|---|---|---|---|---|---|---|---|
| subj | de-identified subject id | numeric | 0 | 1 | 1 | 10 | 19 | 9.973684 | 5.478366 | ▇▇▆▇▇ |
question asked of participants: Force, Probability or Tired
Distribution of values for dv
0 missing values.
| name | label | data_type | n_missing | complete_rate | n_unique | empty | min | max | whitespace |
|---|---|---|---|---|---|---|---|---|---|
| dv | question asked of participants: Force, Probability or Tired | character | 0 | 1 | 3 | 0 | 5 | 11 | 0 |
continuous response 0-100
Force: How much force will this agent need to expend in order to successfully perform the action? (0 = This agent will need to expend very little force; 100 = This agent will need to expend a great amount of force)
Probability: What do you think is likely to happen? (0 = The agent will definitely fail; 100 = The agent will definitely succeed)
Tired: Imagine that the agent successfully jumps across the cliff. How tired will they be afterwards? (0 - This agent will not be tired at all; 100 - This agent will be extremely tired)
Distribution of values for response
0 missing values.
| name | label | data_type | n_missing | complete_rate | min | median | max | mean | sd | hist |
|---|---|---|---|---|---|---|---|---|---|---|
| response | continuous response 0-100 Force: How much force will this agent need to expend in order to successfully perform the action? (0 = This agent will need to expend very little force; 100 = This agent will need to expend a great amount of force) Probability: What do you think is likely to happen? (0 = The agent will definitely fail; 100 = The agent will definitely succeed) Tired: Imagine that the agent successfully jumps across the cliff. How tired will they be afterwards? (0 - This agent will not be tired at all; 100 - This agent will be extremely tired) |
numeric | 0 | 1 | 0 | 70 | 100 | 60.46053 | 31.59911 | ▃▃▂▆▇ |
The following JSON-LD can be found by search engines, if you share this codebook publicly on the web.
{
"name": "Manipulating Width vs Depth, Pilot Study, Codebook",
"description": "Adult pilto data associated with the paper 'Dangerous ground: One-year-old infants are sensitive to peril in other agents’ action plans'\n\n\n## Table of variables\nThis table contains variable names, labels, and number of missing values.\nSee the complete codebook for more.\n\n[truncated]\n\n### Note\nThis dataset was automatically described using the [codebook R package](https://rubenarslan.github.io/codebook/) (version 0.9.2).",
"creator": "Shari Liu",
"datePublished": "2022-06-18",
"keywords": ["V1", "Depth", "Width", "subj", "dv", "response"],
"@context": "http://schema.org/",
"@type": "Dataset",
"variableMeasured": [
{
"name": "V1",
"@type": "propertyValue"
},
{
"name": "Depth",
"description": "depth of the trench on the current trial, range 1-4",
"@type": "propertyValue"
},
{
"name": "Width",
"description": "width of the trench on the current trial, range 1-4",
"@type": "propertyValue"
},
{
"name": "subj",
"description": "de-identified subject id",
"@type": "propertyValue"
},
{
"name": "dv",
"description": "question asked of participants: Force, Probability or Tired",
"@type": "propertyValue"
},
{
"name": "response",
"description": "continuous response 0-100\n\nForce: How much force will this agent need to expend in order to successfully perform the action? (0 = This agent will need to expend very little force; 100 = This agent will need to expend a great amount of force)\n\nProbability: What do you think is likely to happen? (0 = The agent will definitely fail; 100 = The agent will definitely succeed)\n\nTired: Imagine that the agent successfully jumps across the cliff. How tired will they be afterwards? (0 - This agent will not be tired at all; 100 - This agent will be extremely tired)",
"@type": "propertyValue"
}
]
}`